﻿<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/MainAdmin.Master"
    CodeBehind="AdminAddMenu.aspx.vb" Inherits="QLThuVien.AddMenu" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <script type="text/javascript">
        function hidePL() {
            var seconds = 4;
            setTimeout(function () {
                document.getElementById("<%=successDivPL.ClientID %>").style.display = "none";
            }, seconds * 1000);
        }
        function hideDM() {
            var seconds = 4;
            setTimeout(function () {
                document.getElementById("<%=successDivDM.ClientID %>").style.display = "none";
            }, seconds * 1000);
        }
        function OnGrigColumnResizing(s, e) {
            if (e.column.fieldName == 'slsach')
                e.cancel = true;
        }
        function loadingPanelPL(s, e) {
            lp_phanloai.Show();
        }
        function showAlertMessage(s, e) {
            if (s.cp_showAlertMessage) {
                alert(s.cp_showAlertMessage);
                delete s.cp_showAlertMessage;
            }
        }
        
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <div class="row">
        <div class="col-md-12">
            <h1 class="page-header">
                Thêm - Cập Nhập
            </h1>
        </div>
    </div>
    <asp:UpdatePanel ID="UpdatePanel2" runat="server">
        <ContentTemplate>
            <div class="row">
                <div class="col-lg-12">
                    <div class="panel panel-default">
                        <div class="panel-heading">
                            Danh Mục
                        </div>
                        <div class="panel-body">
                            <div class="row">
                                <div class="col-lg-12">
                                    <div class="form-group">
                                        <label>
                                            Danh Sách</label>
                                        <div class="col-md-12">
                                            <div class="panel panel-default">
                                                <div class="panel-body">
                                                    <div class="panel-group" id="Div1">
                                                        <div class="panel panel-default">
                                                            <div class="panel-body">
                                                                <div class="form-group">
                                                                    <dx:ASPxGridView ID="gridDM" runat="server" 
                                                                        Width="100%" AutoGenerateColumns="False" KeyFieldName="id" EnableCallBacks="true">
                                                                        <Columns>
                                                                            <dx:GridViewCommandColumn ShowDeleteButton="true" ShowEditButton="true" CellStyle-HorizontalAlign="Center" >
                                                                             <HeaderStyle Font-Bold="True" BackColor="#428bca" ForeColor="White"  HorizontalAlign="Center"  />
                                                                             
                                                                            </dx:GridViewCommandColumn>
                                                                            <dx:GridViewDataColumn FieldName="id" Caption="Mã" EditFormSettings-Visible="False" CellStyle-HorizontalAlign="Center">
                                                                             <HeaderStyle Font-Bold="True" BackColor="#428bca" ForeColor="White"  HorizontalAlign="Center"  />
                                                                            </dx:GridViewDataColumn>
                                                                            <dx:GridViewDataColumn FieldName="tendm" Caption="Tên Danh Mục" CellStyle-HorizontalAlign="Center">
                                                                             <HeaderStyle Font-Bold="True" BackColor="#428bca" ForeColor="White"  HorizontalAlign="Center"  />
                                                                                <EditFormSettings VisibleIndex="1" Visible="True" />
                                                                            </dx:GridViewDataColumn>
                                                                        </Columns>
                                                                        <Styles>
                                                                            <TitlePanel Font-Bold="true" CssClass="alert alert-warning">
                                                                            </TitlePanel>
                                                                        </Styles>
                                                                        <Settings ShowFilterRow="True" ShowGroupPanel="True" ShowStatusBar="Hidden" />
                                                                        <SettingsEditing EditFormColumnCount="1" />
                                                                        <SettingsDataSecurity AllowInsert="False" />
                                                                        <SettingsSearchPanel Visible="True" />
                                                                        <SettingsBehavior ConfirmDelete="true" />
                                                                        <SettingsText ConfirmDelete="Bạn Có Muốn Xóa Không?" />
                                                                         <SettingsCommandButton>
                                                                         
            <EditButton Image-IconID="actions_edit_16x16devav" ButtonType="Image"></EditButton>
            <DeleteButton Image-IconID="actions_cancel_16x16office2013" ButtonType="Image"></DeleteButton>
            <UpdateButton Image-IconID="actions_refresh_16x16office2013" ButtonType="Image"   ></UpdateButton>
            <CancelButton Image-IconID ="actions_close_16x16devav" ButtonType="Image" ></CancelButton>
        </SettingsCommandButton>    
        <ClientSideEvents EndCallback="showAlertMessage" /> 
                                                                    </dx:ASPxGridView>
                                                                </div>
                                                            </div>
                                                        </div>
                                                    </div>
                                                    <div class="panel panel-default">
                                                        <div class="panel-heading">
                                                            <h4 class="panel-title">
                                                                <a data-toggle="collapse" data-parent="#accordion" href="#collapseOne" class="collapsed">
                                                                    <button id="bt_themdm"  type="button" class="btn btn-primary btn-circle" clientidmode="Static" ><i class="fa fa-plus"></i>
                                                            </button>         
                                                                </a>
                                                            </h4>
                                                        </div>
                                                        <div class="alert alert-success" runat="server" id="successDivDM" visible="false">
                                                            <dx:ASPxLabel ID="lb_messDM" runat="server" Font-Bold="true">
                                                            </dx:ASPxLabel>
                                                        </div>
                                                        <div id="collapseOne" class="panel-collapse collapse" style="height: 0px;">
                                                            <div class="panel-body">
                                                                <div class="form-group">
                                                                    <label>
                                                                        Tên Danh Mục</label>
                                                                    <dx:ASPxTextBox ID="txt_danhmuc" runat="server" CssClass="form-control" Width="50%" NullText="Nhập Tên Danh Mục..." >
                                                                        <ValidationSettings ErrorTextPosition="Bottom" ValidationGroup="vg_dm">
                                                                            <RequiredField IsRequired="true" ErrorText="Chưa Nhập Tên" />
                                                                        </ValidationSettings>
                                                                    </dx:ASPxTextBox>
                                                                </div>
                                                                <div class="form-group">
                                                                    <dx:ASPxButton ID="btn_xacnhandm" runat="server" Text="Xác Nhận" CssClass="btn btn-primary"
                                                                        ValidationGroup="vg_dm"  ClientSideEvents-Click="function(s,e){hideDM()}" >
                                                                    </dx:ASPxButton>
                                                                    <dx:ASPxButton ID="btn_hoantacdm" runat="server" Text="Hoàn Tác" CssClass="btn btn-danger"
                                                                        CausesValidation="false"  >
                                                                    </dx:ASPxButton>
                                                                </div>
                                                            </div>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <!-- /.row (nested) -->
                        </div>
                        <!-- /.panel-body -->
                    </div>
                    <div class="panel panel-default" id="containerPL">
                        <div class="panel-heading">
                            Phân Loại Theo Danh Mục
                        </div>
                        <div class="panel-body">
                            <div class="row">
                                <div class="col-lg-6">
                                    <div class="form-group">
                                        <label>
                                            Danh Mục</label>
                                        <dx:ASPxComboBox ID="cb_danhmuc" runat="server" ValueType="System.String" TextField="tendm"
                                            ValueField="id" CssClass="form-control" NullText="Chọn Danh Mục..."  AutoPostBack="true">
                                            <ClientSideEvents SelectedIndexChanged="loadingPanelPL"  />
                                        </dx:ASPxComboBox>
                                    </div>
                                </div>
                                <div class="col-lg-6">
                                    <div class="form-group">
                                        <label>
                                            Phân Loại</label>
                                        <div class="col-md-12">
                                            <div class="panel panel-default">
                                                <div class="panel-body">
                                                    <div class="panel-group" id="accordion">
                                                        <div class="panel panel-default">
                                                            <div class="panel-body">
                                                                <div class="form-group">
                                                                    <dx:ASPxGridView ID="gridpl" runat="server" EnableTheming="True" 
                                                                        Width="100%" AutoGenerateColumns="False" KeyFieldName="Id" EnableCallBacks="true"
                                                                        Visible="false">
                                                                        <Columns>
                                                                            <dx:GridViewCommandColumn ShowDeleteButton="true" ShowEditButton="true" Width="100" CellStyle-HorizontalAlign="Center">
                                                                             <HeaderStyle Font-Bold="True" BackColor="#428bca" ForeColor="White"  HorizontalAlign="Center"  />
                                                                            </dx:GridViewCommandColumn>
                                                                            <dx:GridViewDataColumn FieldName="Id" Caption="Mã" Width="35" EditFormSettings-Visible="False" CellStyle-HorizontalAlign="Center">
                                                                             <HeaderStyle Font-Bold="True" BackColor="#428bca" ForeColor="White"  HorizontalAlign="Center"  />
                                                                            </dx:GridViewDataColumn>
                                                                            <dx:GridViewDataColumn FieldName="phanloai" Caption="Tên Phân Loại" Width="140" CellStyle-HorizontalAlign="Center">
                                                                             <HeaderStyle Font-Bold="True" BackColor="#428bca" ForeColor="White"  HorizontalAlign="Center"  />
                                                                                <EditFormSettings VisibleIndex="1" Visible="True" />
                                                                            </dx:GridViewDataColumn>
                                                                            <dx:GridViewDataColumn FieldName="slsach" Caption="Số Lượng Sách" Width="100" EditFormSettings-Visible="False"
                                                                             CellStyle-HorizontalAlign="Center"
                                                                                ReadOnly="true">
                                                                                <HeaderStyle Font-Bold="True" BackColor="#428bca" ForeColor="White"  HorizontalAlign="Center"  />
                                                                            </dx:GridViewDataColumn>
                                                                        </Columns>
                                                                        <Styles>
                                                                            <TitlePanel Font-Bold="true" CssClass="alert alert-warning">
                                                                            </TitlePanel>
                                                                        </Styles>
                                                                        <Settings ShowFilterRow="True" ShowGroupPanel="True" ShowStatusBar="Hidden" />
                                                                        <SettingsEditing EditFormColumnCount="1" />
                                                                        <SettingsDataSecurity AllowInsert="False" />
                                                                        <SettingsSearchPanel Visible="True" />
                                                                        <SettingsBehavior ColumnResizeMode="NextColumn" ConfirmDelete="true" />
                                                                        <Settings HorizontalScrollBarMode="Visible" />
                                                                        <SettingsText ConfirmDelete="Bạn Có Muốn Xóa Không?" />
                                                                         <SettingsCommandButton>
            <EditButton Image-IconID="actions_edit_16x16devav" ButtonType="Image"></EditButton>
            <DeleteButton Image-IconID="actions_cancel_16x16office2013" ButtonType="Image"></DeleteButton>
            <UpdateButton Image-IconID="actions_refresh_16x16office2013" ButtonType="Image"   ></UpdateButton>
            <CancelButton Image-IconID ="actions_close_16x16devav" ButtonType="Image" ></CancelButton>
        </SettingsCommandButton>    
        <ClientSideEvents EndCallback="showAlertMessage" /> 
                                                                    </dx:ASPxGridView>
                                                                </div>
                                                            </div>
                                                        </div>
                                                    </div>
                                                    <dx:ASPxLoadingPanel ID="lp_phanloai" runat="server" Modal="true" ContainerElementID="containerPL" ClientInstanceName="lp_phanloai" >
                                                    </dx:ASPxLoadingPanel> 
                                                    <div class="panel panel-default">
                                                        <div class="panel-heading">
                                                            <h4 class="panel-title">
                                                                <a data-toggle="collapse" data-parent="#accordion" href="#collapseTwo" class="collapsed">
                                                                    <button id="btn_them" runat="server" disabled="true" type="button" class="btn btn-primary btn-circle" clientidmode="Static" ><i class="fa fa-plus"></i>
                                                                    </button>         
                                                                </a>
                                                            </h4>
                                                        </div>
                                                        <div class="alert alert-success" runat="server" id="successDivPL" visible="false">
                                                            <dx:ASPxLabel ID="lb_messpl" runat="server" Font-Bold="true">
                                                            </dx:ASPxLabel>
                                                        </div>
                                                        <div id="collapseTwo" class="panel-collapse collapse" style="height: 0px;">
                                                            <div class="panel-body">
                                                                <div class="form-group">
                                                                    <label>
                                                                        Tên Phân Loại</label>
                                                                    <dx:ASPxTextBox ID="txt_phanloai" runat="server" Width="100%" CssClass="form-control" NullText="Nhập Tên Phân Loại..." 
                                                                        ValidationSettings-ValidationGroup="vg_pl">
                                                                        <ValidationSettings ErrorTextPosition="Bottom" >
                                                                            <RequiredField IsRequired="true" ErrorText="Chưa Nhập Tên" />
                                                                        </ValidationSettings>
                                                                    </dx:ASPxTextBox>
                                                                </div>
                                                                <div class="form-group">
                                                                    <dx:ASPxButton ID="btn_xacnhanpl" runat="server" Text="Xác Nhận" CssClass="btn btn-primary"
                                                                        ClientSideEvents-Click="function(s,e){hidePL()}" ValidationGroup="vg_pl">
                                                                    </dx:ASPxButton>
                                                                    <dx:ASPxButton ID="btn_hoantacpl" runat="server" Text="Hoàn Tác" CssClass="btn btn-danger"
                                                                        CausesValidation="false" >
                                                                    </dx:ASPxButton>
                                                                </div>
                                                            </div>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>
